import javax.swing.*;
/**
 * Write a description of class StatsView here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class StatsView extends JLabel
{
	// instance variables - replace the example below with your own
	private final String POPULATION_PREFIX = "Population: ";
	private SimulatorModel model;
	/**
	 * Constructor for objects of class StatsView
	 */

	public StatsView(SimulatorModel model)
	{
	    super();
	    setHorizontalAlignment(CENTER);
	    this.model=model;
	}

	/**
	 * An example of a method - replace this comment with your own
	 * 
	 * @param  y   a sample parameter for a method
	 * @return     the sum of x and y 
	 */
	public void update()
	{
		Field field=model.getField();
		setText(POPULATION_PREFIX+field.getPopulationDetails());
	}
}
